package config

import (
	"github.com/hwcer/yyds"
)

// 道具类型分析
func init() {
	yyds.Config.Register(&emitter{})
}

type emitter struct {
	HandleDefault
}

func (this *emitter) Verify(c *yyds.CS, i any) (errs []error) {
	data := i.(*output)
	for _, d := range data.Emitter {
		if d.Daily > 0 {
			c.ITypes.Add(d.Daily, ITypeDaily, 0, d.Name)
		}
		if d.Record > 0 {
			c.ITypes.Add(d.Record, ITypeRecord, 0, d.Name)
		}
	}
	for _, v := range data.Daily {
		c.ITypes.Add(v.Id, ITypeDaily, 0, v.Name)
	}
	for _, v := range data.Record {
		c.ITypes.Add(v.Id, ITypeRecord, 0, v.Name)
	}
	return
}
